import { defineStore } from 'pinia'
import { postShareListRequest } from '@/service/module/share/sharelist/sharelist'

interface IShareListdemo {
  title: string
  subtitle: string
  image: string
  _id: number
  content: string
  createdAt: Date
}

export const useShareListStore = defineStore('newslist', {
  state: () => ({
    shareListdemo: [] as IShareListdemo[],
    total: 0,
    _id: 0,
  }),

  getters: {
    // GET_TRAIN() {
    //     this.getTrainList()
    // }
  },
  actions: {
    //行测技巧列表数据
    async shareListResultAction(sharelist: any) {
      const res = await postShareListRequest(sharelist)

      this.shareListdemo = res.data.data.findShareListData
      this.total = res.data.data.total
      // console.log(res, '888888')
    },
  },
  // persist: true,
})
